package com.zoroki.student_score_system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zoroki.student_score_system.domain.Class;
import com.zoroki.student_score_system.service.ClassService;
import com.zoroki.student_score_system.mapper.ClassMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【class】的数据库操作Service实现
* @createDate 2025-06-30 12:49:21
*/
@Service
public class ClassServiceImpl extends ServiceImpl<ClassMapper, Class>
    implements ClassService{
    @Autowired
    private ClassMapper classMapper;

    @Override
    public List<Class> findAllClass() {
        return classMapper.selectList(null);
    }

    @Override
    public Class getClassById(int id) {
        return classMapper.selectById(id);
    }

    @Override
    public boolean deleteClassById(int id) {
        return classMapper.deleteById(id) > 0;
    }

    @Override
    public boolean addClass(Class c) {
        return classMapper.insert(c) > 0;
    }

    @Override
    public boolean updateClass(Class c) {
        return classMapper.updateById(c) > 0;
    }
}




